<?php
session_start();
 
    if(isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])=="xmlhttprequest"){
    
    include '../c/config.php';
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    $queryG=$mysqli->query("SELECT zhangai_tu,zhangai_txt,jinbi_tu FROM `z_game` where is_open=1 ");
    if($queryG->num_rows>0){
        $getGame=$queryG->fetch_assoc();
        $objarr=array();
        $moneyarr=array();
        $zhangai_tu=json_decode($getGame['zhangai_tu'],true);
        $zhangai_txt=json_decode($getGame['zhangai_txt'],true);
        $jinbi_tu=json_decode($getGame['jinbi_tu'],true);
        foreach ($zhangai_tu as $k=>$v){
            $url='http://climb-game.51wom.com/app/data/upload/'.$v;
            $img = imagecreatefrompng($url);
            $objarr[]=array(
                "src"=>'app/data/upload/'.$v,
                "type"=>"kill",
                "width"=>imagesx( $img ),
                height=>imagesy( $img ),
                "title"=>$zhangai_txt[$k]['a'],
                "des1"=>$zhangai_txt[$k]['b'],
                "des2"=>$zhangai_txt[$k]['c'],
            );
        }
        foreach ($jinbi_tu as $k=>$v){
            $url='http://climb-game.51wom.com/app/data/upload/'.$v;
            $img = imagecreatefrompng($url);
            $moneyarr[]=array(
                "src"=>'app/data/upload/'.$v,
                "type"=>"money",
                "width"=>imagesx( $img ),
                height=>imagesy( $img )
            );
        }
        echo json_encode(array('s'=>'y','obj'=>$objarr,'moneyarr'=>$moneyarr));
        
    }else{
        echo json_encode(array('s'=>'n'));
    }
    
    
    $mysqli->close();
   
    
    
   }
 
?>